package impl

import (
	"ylb/entity"
	"ylb/mapper"
)

type NoteServiceImpl struct {
	mapper mapper.NoteMapper
}

func NewNoteServiceImpl() NoteServiceImpl {
	impl := NoteServiceImpl{}
	impl.mapper = mapper.NewNoteMapper()
	return impl
}
func (n NoteServiceImpl) InsertNote(note entity.Note) int64 {
	if note.UserId == 0 {
		return 0
	}
	return n.mapper.InsertOne(note)
}
func (n NoteServiceImpl) SaveNote(note entity.Note) int64 {
	if note.UserId == 0 {
		return 0
	}
	return n.mapper.Update(note)

}
func (n NoteServiceImpl) SelectNoteByUserId(userId uint) entity.Note {
	return n.mapper.SelectNoteByUserId(userId)
}
